package com.itheima.fanshe;

import com.itheima.domain.Student;

import java.lang.reflect.Constructor;
import java.sql.Array;
import java.util.Arrays;

/*
获取类的构造方法对象
 */
public class Demo06 {

    public static void main(String[] args) throws NoSuchMethodException {

        Class<Student> clazz = Student.class;
        //有s 没有declared 所有公共的
        Constructor<?>[] constructors = clazz.getConstructors();
        System.out.println(Arrays.toString(constructors));
        //有s 有 declared 所有自己声明的
        Constructor<?>[] constructors2 = clazz.getDeclaredConstructors();
        System.out.println(Arrays.toString(constructors2));
        //没有 s 没有declared  单个且 public
        Constructor<Student> constructor = clazz.getConstructor(String.class, int.class);
        System.out.println(constructor);
       /* Constructor<Student> constructor3 = clazz.getConstructor(String.class);
        System.out.println(constructor3);*/
        Constructor<Student> constructor2 = clazz.getDeclaredConstructor();
        System.out.println(constructor2);
        Constructor<Student> constructor4 = clazz.getDeclaredConstructor(int.class);
        System.out.println(constructor4);
    }
}
